package com.example.demo.pojo;

import org.jetbrains.annotations.NotNull;

import java.util.List;
/**
 * @author luolinila
 */
public class HandPoker implements Comparable<HandPoker> {
    int rank;
    List<Integer> pokers;

    public HandPoker(int rank, List<Integer> pokers) {
        this.rank = rank;
        this.pokers = pokers;
    }

    @Override
    public int compareTo(@NotNull HandPoker o) {
        if (this.rank != o.rank) {
            return Integer.compare(this.rank, o.rank);
        }
        for (int i = 0; i < this.pokers.size(); i++) {
            int compare = Integer.compare(this.pokers.get(i), o.pokers.get(i));
            if (compare != 0) {
                return compare;
            }
        }
        return 0;
    }
}
